package com.aweqy.hrmanager.controller;

import com.aweqy.hrmanager.entity.Extension;
import com.aweqy.hrmanager.service.ExtensionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;

@RestController
@RequestMapping("/api/extensions")
public class ExtensionController {
    @Autowired
    private ExtensionService extensionService;

    @GetMapping
    public List<Extension> list() {
        return extensionService.list();
    }

    @PostMapping
    public boolean add(@RequestBody Extension extension) {
        return extensionService.save(extension);
    }

    @PutMapping
    public boolean update(@RequestBody Extension extension) {
        return extensionService.updateById(extension);
    }

    @DeleteMapping("/{id}")
    public boolean delete(@PathVariable Integer id) {
        return extensionService.removeById(id);
    }
} 